[11.x] Rename the method whereNone
to whereNotAny
in the query builder
#52383
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR#52361 suggests the introduction of the negated version for
whereAll
calledwhereNotAll
. This got me thinking about the naming of thewhereNone
query that was published in the last release, which is the negated version ofwhereAny
. With the introduction ofwhereNotAll
, I realized we might want to reconsider the name ofwhereNone
for clarity and consistency, as none is the opposite to both "any" and "all".I propose renaming
whereNone
towhereNotAny
. Here's why:whereAny
.whereNotAll
, and most of the other queries in the framework, for example;whereIn
/whereNotIn
,whereLike
/whereNotLike
,whereBetween
/whereNotBetween
and so on...If we make this change, our method names would be:
whereAll
: Return rows where all conditions are truewhereNotAll
: Return rows excluding where all conditions are truewhereAny
: Return rows where at least one condition is truewhereNotAny
: Return rows excluding where at least one condition is true (currentlywhereNone
)The name whereNotAny might be a bit clunkier, but I think it provides a clearer developer experience, especially when considered alongside whereNotAll.
This PR adds the @deprecated tag to the docblocks of whereNone (since users might already started using it), and makes whereNone forward all arguments to whereNotAny, so that we in the future can remove the whereNone methods safely. Also the tests have been updated with tests for the new naming.
The docblocks are updated to accept \Illuminate\Contracts\Database\Query\Expression[], since the user can pass in column names from the DB::raw() method, also the
$operator
is changed from string to mixed, to match the signature in thewhere
method.